/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bankapp.view;

import framework.model.Account;
import framework.model.Customer;
import framework.model.IAccount;
import framework.view.AccountTableModel;
import java.util.List;

/**
 *
 * @author ThanhNguyen
 */
public class BankTableModel extends AccountTableModel {

    public BankTableModel() {
        columnNames = new String[]{"Name", "Street", "City", "State", "Zip", "P/C", "Ch/S", "Amount"};
    }

    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
        List<Account> accounts = financialCompany.getAccounts();
        IAccount account = accounts.get(rowIndex);
        Customer customer = account.getCustomer();
        switch (columnIndex) {
            case 0:
                return customer;
            case 1:
                return customer.getAddress().street;
            case 2:
                return customer.getAddress().city;
            case 3:
                return customer.getAddress().state;
            case 4:
                return customer.getAddress().zip;
            case 5:
                return customer.getType();
            case 6:
                return account;
            case 7:
                return account.getCurrentBalance();
            default:
                return null;
        }
    }
}
